<template>
  <Portlet :title="title">
    <el-form label-position="left" label-width="110px">
      <el-row>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="公司编号:">
            <span>{{ data.code }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="公司名称:">
            <span>{{ data.name }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="统一社会代码:">
            <span>{{ data.communityCode }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="注册日期:">
            <span>{{ data.registeDate | unixTimestampFilter }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="公司法人:">
            <span>{{ data.legalPerson }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="总经理:">
            <span>{{ data.manager }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="状态:">
            <span>{{ data.state == 1 ? '启用' : '停用'}}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="办公地址:">
            <span>{{ data.province }} {{ data.city }} {{ data.district }} {{ data.detailAddress }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="公司域名:">
            <span>{{ data.url }}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="8" :md="12" :xl="6">
          <el-form-item label="对外服务热线:">
            <span>{{data.serviceHotline}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="LOGO:">
            <upload-image :formData="{}" :readonly="true"
                          :value="getImage(data.logo)"></upload-image>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="clearfix"></div>
  </Portlet>
</template>
<script>
import {unixTimestampFilter} from '@/filters'

export default {
  filters: {
    unixTimestampFilter
  },
  props: {
    data: {
      type: Object,
      default() {
        return {}
      }
    },
    title: {
      type: String,
      default: '公司信息'
    }
  },
  data() {
    return {}
  },
  methods: {
    getImage(val) {
      if (Array.isArray(val)) {
        return val
      }
      if (typeof val === 'string' && val) {
        return val.split(',')
      }
      return []
    }
  }
}
</script>
